package com.wushi.lenovo.asia5b.app_model.wish;

import android.text.TextUtils;

import com.mvp.base.model.BaseModel;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by zhangyuncai on 2018/12/19.
 * wishlist;//(0: No, 1: Yes) 0/1 未收藏/已收藏
 * 商品详情
 */
public class GoodsDetailModel extends BaseModel {
    /*
           "id": 446847,
       "price": "1161.33",
       "market_price": "1161.33",
       "is_bargain_price": 0,
       "sku_stock": 0,
       "name": "YFR-55KW智能在线式软启动器 380V水泵电机中文在线式软起动器柜",
       "status": 0,
       "display_price": "1780.00-1850.00",
       "min_quantity": 1,
       "prod_unit": "台",
       "desc": "<div  class=\"col-xs-12 no-gutters\" style=\"margin-bottom: 20px;\">\n        <div
reak-word;\">软起基值电压: 30%-80%<\/label>\n    <\/div>\n        <div class=\"col-xs-12 no-xs-gutters co
.jpg' \/><br \/><br \/><img alt='undefined' src='https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/721\
       "type": 1,
       "is_active": 1,
       "source": "1688",
       "source_country_id": 12,
       "source_default_language": 2,
       "goods_attr": "eJx9jjtOQ0EMRfcyPdKMx\/Z8Xo8UIVHQIErPr0GpXqjQ61JBkR1ENIglUMBySMQymImADirryvfY
       "click_count": 0,
       "add_to_cart_count": 0,
       "comment_count": 1,
       "good_rate_percentage": 100,
       "url": "https:\/\/detail.1688.com\/offer\/582250155080.html",
       "shop_id": "cnyofan",
       "chn_local_shippg_fee": "401.76",
       "chn_local_shippg_fee_seller": "640.00",
       "display_chn_local_shippg_fee": "",
       "source_id": "582250155080",
       "sell_counts": 0,
       "seller_info": {
           "seller_nickname": "刘军",
           "biz_type": "生产厂家",
           "evaluates": [
               {
                   "title": "描述",
                   "score": "3%"
               },
               {
                   "title": "响应",
                   "score": "12%"
               },
               {
                   "title": "物流",
                   "score": "22%"
               },
               {
                   "title": "回头率",
                   "score": "13%"
               }
           ],
           "seller_name": "永帆电气有限公司"
       },
       "seller_name": "永帆电气有限公司",
       "product_comments": [],
       "goods_thumb": "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_932911794
       "goods_img": "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_932911794.6
       "original_img": "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_93291179
       "product_features": [
           "产地: 浙江温州",
           "是否进口: 否",
           "品牌: YOF",
           "货号: YFRC-55KW",
           "型号: YFR-55KW",
           "产品系列: YFRC电机软启动器",
           "用途: 软启动",
           "额定电流: 150",
           "额定电压: 380",
           "额定绝缘电压: 1500",
           "防护等级: ip20",
           "类型: 软起动器",
           "应用场景: 电动机控制与保护",
           "操作方式: 自动",
           "是否可逆: 否",
           "额定冲击耐受电压: 2.5",
           "软起基值电压: 30%-80%",
           "控制电动机功率: ＜55KW",
           "斜坡下降时间: 0-16",
           "突跳起动时间: 16",
           "适用电机: 55kw",
           "产品认证: CCC",
           "加工定制: 是",
           "订货号: YFRC-55KW",
           "最小包装数: 1",
           "物料编号: YFRC-55KW",
           "3C证书编号: 2016010304873581",
           "规格报价: 1850",
           "是否跨境货源: 否",
           "系列: YFR"
       ],
       "dimension": null,
       "weight": null,
       "pcs_of_unit": null,
       "carton_uom": null,
       "carton_qty": null,
       "pack_uom": null,
       "pack_qty_in_carton": null,
       "carton_unit_uom": null,
       "num_of_qty_in_carton": null,
       "updated_at": "2020-04-08 12:56:53",
       "img_url": [
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/265\/159\/9421951562_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/027\/953\/9653359720_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/307\/006\/9627600703_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/581\/383\/9653383185_932911794.640x640.jp
       ],
       "thumb_url": [
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/265\/159\/9421951562_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/027\/953\/9653359720_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/307\/006\/9627600703_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/581\/383\/9653383185_932911794.640x640.jp
       ],
       "img_original": [
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/956\/563\/9653365659_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/265\/159\/9421951562_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/027\/953\/9653359720_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/307\/006\/9627600703_932911794.640x640.jp
           "https:\/\/cbu01.alicdn.com\/img\/ibank\/2018\/581\/383\/9653383185_932911794.640x640.jp
       ],
       "seller_prod_id": null,
       "sell_case_unit": null,
       "sell_scale_value": null,
       "regrab_by": 1,
       "crawl_again": 0,
       "currency": "RM",
       "source_currency": "¥",
       "price_seller": "1850.00",
       "market_price_seller": "1850.00",
       "discount": "0%",
       "goods_attr_cat": {
           "cfcd208495d565ef66e7dff9f98764da": {
               "catName": "型号",
               "skuItem": {
                   "b4b147bc522828731f1a016bfa72c073": "YFR-55KW"
               }
           },
           "c4ca4238a0b923820dcc509a6f75849b": {
               "catName": "规格报价",
               "skuItem": {
                   "d3d9446802a44259755d38e6d163e820": "1850"
               }
           }
       },
       "multiple_price": [
           {
               "id": 25824,
               "product_id": 446847,
               "min_quantity": 1,
               "max_quantity": 99,
               "sort_order": 1,
               "price": 1850,
               "market_price": 1850,
               "created_at": "2020-04-08 12:56:39",
               "updated_at": "2020-04-08 12:56:39",
               "quantity_str": "1 - 99台",
               "buyer_price": "1161.33",
               "seller_price": 1850,
               "buyer_market_price_no_format": "1161.33",
               "buyer_market_price": "1161.33",
               "seller_market_price": 1850,
               "discount": "0%"
           },
           {
               "id": 25825,
               "product_id": 446847,
               "min_quantity": 100,
               "max_quantity": null,
               "sort_order": 2,
               "price": 1780,
               "market_price": 1780,
               "created_at": "2020-04-08 12:56:39",
               "updated_at": "2020-04-08 12:56:39",
               "quantity_str": "≥100台",
               "buyer_price": "1117.39",
               "seller_price": 1780,
               "buyer_market_price_no_format": "1117.39",
               "buyer_market_price": "1117.39",
               "seller_market_price": 1780,
               "discount": "0%"
           }
       ],
       "wishlist": 0,
       "carton_content": "",
       "hide_source_price": 0
   }
     */


    private int id;
    private String discount;//折扣比
    private Object currency;//商品来源国货币
    private Object price_seller;//价格
    private Object source;//来源 taobao
    private String url;
    private LinkedHashMap<String, GoodsAttrCatBean> goods_attr_cat;
    private Map<String, String> goods_attr_stock;
    private Map<String, String> goods_attr_market_price_seller;
    private Map<String, String> goods_attr_market_price;//原价,上面的,RM86.60
    private Map<String, String> goods_attr_price;//（人民币,右边的）￥79.90
    private Map<String, String> goods_attr_price_rm;//折扣价,下面的RM48.98
    private Map<String, String> goods_attr_discount;//87%
    private String wishlist;
    private int min_quantity;//最低商品数
    private List<Multiple_priceBean> multiple_price;
    private String type;// 1=daigou, 3=markeplace

    public String getType() {
        return type;
    }

    public Object getCurrency() {
        return currency;
    }

    public Object getPrice_seller() {
        return price_seller;
    }

    public Object getSource() {
        return source;
    }

    public String getDiscount() {
        return discount;
    }

    public int getMin_quantity() {
        return min_quantity;
    }


    public List<Multiple_priceBean> getMultiple_price() {
        return multiple_price;
    }

    public Map<String, String> getGoods_attr_stock() {
        return goods_attr_stock;
    }


    public Map<String, String> getGoods_attr_market_price() {
        return goods_attr_market_price;
    }

    public Map<String, String> getGoods_attr_discount() {
        return goods_attr_discount;
    }

    public Map<String, String> getGoods_attr_market_price_seller() {
        return goods_attr_market_price_seller;
    }


    public Map<String, String> getGoods_attr_price() {
        return goods_attr_price;
    }


    public Map<String, String> getGoods_attr_price_rm() {
        return goods_attr_price_rm;
    }


    public int getId() {
        return id;
    }


    public String getUrl() {
        return url;
    }


    public LinkedHashMap<String, GoodsAttrCatBean> getGoods_attr_cat() {
        return goods_attr_cat;
    }


    public static class GoodsAttrCatBean {
        /**
         * 20509 : {"catName":"尺码","skuItem":{"28314":"S","28315":"M","28316":"L"}}
         * 1627207 : {"catName":"颜色分类","skuItem":{"28320":"白色","28341":"黑色"},"imgIcon":{"28320":"//img.alicdn.com/imgextra/i3/2535708021/TB2MdhflXuWBuNjSszbXXcS7FXa_!!2535708021.jpg","28341":"//img.alicdn.com/imgextra/i2/2535708021/TB2zfeVlmBYBeNjy0FeXXbnmFXa_!!2535708021.jpg"}}
         */

        private String catName;
        private LinkedHashMap<String, String> skuItem;
        private LinkedHashMap<String, String> imgIcon;

        public String getCatName() {
            return catName;
        }

        public LinkedHashMap<String, String> getSkuItem() {
            return skuItem;
        }

        public LinkedHashMap<String, String> getImgIcon() {
            return imgIcon;
        }

        @Override
        public String toString() {
            return "GoodsAttrCatBean{" +
                    "catName='" + catName + '\'' +
                    ", skuItem=" + skuItem +
                    ", imgIcon=" + imgIcon +
                    '}';
        }
    }

    public static class Multiple_priceBean extends BaseModel {
        /*
         {
     "id": 25824,
     "product_id": 446847,
     "min_quantity": 1,
     "max_quantity": 99,
     "sort_order": 1,
     "price": 1850,
     "market_price": 1850,
     "created_at": "2020-04-08 12:56:39",
     "updated_at": "2020-04-08 12:56:39",
     "quantity_str": "1 - 99台",
     "buyer_price": "1161.33",
     "seller_price": 1850,
     "buyer_market_price_no_format": "1161.33",
     "buyer_market_price": "1161.33",
     "seller_market_price": 1850,
     "discount": "0%"
 },
         */
        /*
        todo 2019-01-01修改成以下
        buyer_price = 24.80 现价
seller_price = 80.00 人民币价
buyer_market_price = 49.60 原价
todo 2020-04-08修改成以下
原价 - buyer_market_price,  现价 - buyer_price, 人民币- price
discount = -50% 折扣
一定要根据 min_quantity和max_quantity
         */

        private String min_quantity;
        private String max_quantity;
        private String price;
        private String market_price;
        private String buyer_price;
        private String seller_price;
        private String buyer_market_price_no_format;
        private String buyer_market_price;
        private String seller_market_price;
        private String discount;//折扣

        /*
        现价
         */
        public String getBuyer_price() {
            return buyer_price;
        }

        /*
        原价
         */
        public String getBuyer_market_price() {
            return buyer_market_price;
        }

        /*
        人民币价
         */
        public String getPrice() {
            return price;
        }

        //最低值是1
        public int getMin_quantityI() {
            if (TextUtils.isEmpty(min_quantity)) {
                return 1;
            } else {
                int i = parseInteger(min_quantity);
                if (i < 1) {
                    i = 1;
                }
                return i;
            }
        }

        /*
        折扣比例
         */
        public String getDiscount() {
            return discount;
        }

        //最大值,默认是100000
        public int getMax_quantityI() {
            if (TextUtils.isEmpty(max_quantity)) {
                return 100000;
            } else {
                int i = parseInteger(max_quantity);
                if (i < 1) {
                    i = 100000;
                }
                return i;
            }
        }


    }
}
